local handle2

local function sleep(n)
	local now = os.clock()
	while now + n >= os.clock() do
	end
end

local function func1()
	while true do
		local rs = coroutine.resume(handle2)
		print(rs, " func1---111")
		sleep(1)
	end
end

local function func2()
	while true do
		print("xxxxxxxxxxxxx")
		coroutine.yield()
		print("func2---222")
		sleep(1)
	end
end

local handle1 = coroutine.create(func1)
handle2 = coroutine.create(func2)

coroutine.resume(handle1)

